package com.qtyx.nms.ui.fragment

import android.graphics.Color
import android.view.View
import com.ldd.base.ui.fragment.BaseLddFragment
import com.qtyx.nms.R
import com.zzhoujay.html.Html
import kotlinx.android.synthetic.main.ac_message_list.*
import kotlinx.android.synthetic.main.fg_zhiban.*


/**
 * 今日值班
 */
class ZhiBanFragment : BaseLddFragment() {
    override fun getLayoutId() = R.layout.fg_zhiban

    override fun initData() {
        wvZhiBan.setBackgroundColor(Color.TRANSPARENT)
    }

    fun setData(content: String) {
        if (content.isNotEmpty()) {
            //所有的P标签，更换为div
            var strContent=content.replace("<p>","<div>")
            strContent=strContent.replace("</p>","</div>")
            wvZhiBan.visibility=View.VISIBLE
            wvZhiBan.loadDataWithBaseURL(null,strContent, "text/html" , "UTF-8", null)
            tvZhiBanEmptyHint.visibility = View.GONE
//            tvZhiBanInfo.text = Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY)
        } else {
            wvZhiBan.visibility=View.GONE
            tvZhiBanEmptyHint.visibility = View.VISIBLE
//            tvZhiBanInfo.text = ""
        }
    }

}